#!/bin/bash
# 判断容器存在就删除
if [[ -n $(docker ps -q -f "name=^nginx$") ]];
then
    docker rm -f nginx;
fi

# 设置主题；把主题文件放到挂载的主页即可
# /bin/cp -rf /home/xtappl/nginx/Nginx-Fancyindex-Theme/Nginx-Fancyindex-Theme-light/ /data1/pub/ && \

# 如果有主题的话可以挂载
# 执行之前先执行 docker build nginx-apline:pub . 构建镜像
# -v /home/xtappl/nginx/Nginx-Fancyindex-Theme/Nginx-Fancyindex-Theme-light/:/etc/nginx/html/ \
# 挂载目录
sudo cp nginx.conf ~/opt/nginx/
docker run -id --name nginx -p 8989:8989 \
    -v ~/opt/nginx/nginx.conf:/etc/nginx/nginx.conf \
    -v ~/opt/nginx/log:/var/log/nginx \
    --restart=always \
    nginx-apline:pub